package com.example.bookdemo.dao;

import com.example.bookdemo.model.bookInfo;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Component//表示交给 Spring 进行管理
public class bookDao {
    public List<bookInfo> mockData(){
        List<bookInfo> bookInfos = new ArrayList<>();
        //先生成15本书
        for (int i = 0; i <15 ; i++) {
//            bookInfo bookInfo = new bookInfo();
//            bookInfo.setBookID(i);
//            bookInfo.setBookName("书籍"+(i+1));
//            bookInfo.setAuthor("作者"+(i+1));
//            bookInfo.setNumber((i+1));
//            bookInfo.setPrice(BigDecimal.valueOf(5*(i+1)));
//            bookInfo.setPublish("出版社"+(i+1));
//            bookInfo.setState(i%2);
//            bookInfos.add(bookInfo);
        }
        return bookInfos;
    }
}
